import React from 'react';
import { Modal, Button } from 'antd';
import './index.less';
class App extends React.Component {
  state = {
    loading: false,
    visible: false,
  }
  showModal = () => {
    this.setState({
      visible: true,
    });
  }
  handleOk = () => {
    this.setState({ loading: true });
    setTimeout(() => {
      this.setState({ loading: false, visible: false });
    }, 3000);
  }
  handleCancel = () => {
    this.setState({ visible: false });
  }
  render() {
    const { visible, loading } = this.state;
    return (
      <div>
        <Button type="primary" onClick={this.showModal}>
          {this.props.text}
        </Button>
        <Modal
          className="alipayreq-modal"
          style={{wordWrap: 'break-word'}}
          visible={visible}
          title="Title"
          onOk={this.handleOk}
          onCancel={this.handleCancel}
          footer={[
            <Button key="back" size="large" onClick={this.handleCancel}>返回</Button>,
            <Button key="submit" type="primary" size="large" loading={loading} onClick={this.handleCancel}>
              确认
            </Button>,
          ]}
        >
          {this.props.content}
        </Modal>
      </div>
    );
  }
}
module.exports = [
 {
    key:'userId',
    title:'用户id',
    dataType:'varchar',
  },
  {
    key:'orderNo',
    title:'订单号',
    dataType:'varchar',
    // primary : true
  },
  {
    key:'reqSn',
    title:'交易流水号',
    dataType:'varchar',
  },
  {
    key:'trxCode',
    title:'请求类型',
    dataType:'varchar',
  },
  {
    key:'retCode',
    title:'请求结果',
    dataType:'varchar',
  },
  {
    key:'requestData',
    title:'请求数据',
    dataType:'varchar',
    width: 0,
    className: 'disnon-table',
    render: (text, record) => {
      return <App text='点击查看' content={text} />
    }
  },
  {
    key:'responseData',
    title:'响应数据',
    dataType:'varchar',
    width: 0,
    className: 'disnon-table',
    render: (text, record) => {
      return <App text='点击查看' content={text} />
    }
  },
];